-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more constructors and entry-APIs for la-arena #12931
Conversation
We enforce integral and `Copy` key, so some key-related functions are not necessary since user can just reuse the index for the `entry` call.
self.slot.as_mut().expect("Occupied") | ||
} | ||
|
||
/// Sets the value of the entry with the `OccupiedEntry`’s key, and returns the entry’s old value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, we already have a couple of smart quotes in the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's copied from std. Should I convert them to '
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to, I guess, since we already have others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, we already have a couple of smart quotes in the codebase.
Hehe that was probably me, since I wrote the la-arena docs and I always use smart quotes out of habit :)
@bors r+ This also needs a version bump, but it seems we don't have auto-publishing set up for it yet. |
☀️ Test successful - checks-actions |
More methods and traits for `la_arena::ArenaMap` Continue of #12931. Seems that I forgot some methods in the previous PR :( I also changed `ArenaMap::insert` to return the old value, to match the map-like collection API of std. **So this is a breaking change.** r? `@lnicola`
There's no schedule, and we don't have the infra for it. In other crates there's a workflow running The main RA crates are published on each release, without checking for changes. Note that the |
la-arena
on crates.io is quite helpful when just a thin wrapper for Vec with u32 indices is needed.But the current API is not ergonomic enough.
This PR
ArenaMap::new
. Not sure why onlyArena
has it now.Arena{,Map}::with_capacity
for known-size storage.ArenaMap
for easier.entry(idx).or_default().push(value)
or.entry(idx).or_insert(...)
operations.